package com.heima.media.controller;

import com.heima.common.dto.ResponseResult;
import com.heima.media.entity.WmNews;
import com.heima.media.service.IAuditService;
import com.heima.media.service.IWmNewsService;
import com.heima.media.service.impl.AuditServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@Api(value = "测试自动审核")
public class TestController {
    @Autowired
    private IWmNewsService newsService;
    @Autowired
    private IAuditService autouditService;
    @PostMapping("{id}")
    @ApiOperation(value = "自动审核",notes = "author:ztz")
    @ApiImplicitParam(dataType = "Integer",name = "id",value = "文章id")
    public ResponseResult Autoudit(@PathVariable("id") Integer id){
        WmNews wmNews = newsService.getById(id);
        autouditService.audit(wmNews);
        return ResponseResult.okResult();
    }
}
